$(function() {
    //地址前缀
    var path = "${pageContext.request.contextPath}";
    //富文本编辑器（免费内容）
    var ue1 = UE.getEditor('freeContent');
    /*ue1.ready(function() {
        //不可编辑
        ue1.setDisabled();
    });*/
    //富文本编辑器（收费内容）
    var ue2 = UE.getEditor('chargeContent');
    /*ue2.ready(function() {
        //不可编辑
        ue2.setDisabled();
    });*/

});

$(function() {
    //下拉框
    if(!ace.vars['touch']) {
        $('.chosen-select').chosen({allow_single_deselect:true});
        $(window)
            .off('resize.chosen')
            .on('resize.chosen', function() {
                $('.chosen-select').each(function() {
                    var $this = $(this);
                    $this.next().css({'width': $this.parent().width()});
                });
            }).trigger('resize.chosen');
        $(document).on('settings.ace.chosen', function(e, event_name, event_val) {
            if(event_name != 'sidebar_collapsed') return;
            $('.chosen-select').each(function() {
                var $this = $(this);
                $this.next().css({'width': $this.parent().width()});
            });
        });
        $('#chosen-multiple-style .btn').on('click', function(e){
            var target = $(this).find('input[type=radio]');
            var which = parseInt(target.val());
            if(which == 2) $('#form-field-select-4').addClass('tag-input-style');
            else $('#form-field-select-4').removeClass('tag-input-style');
        });
    }
});
